package com.zhs.gccs.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhs.gccs.R;
import com.zhs.gccs.vo.ApplyGccsTask;

/**
 * Created by chengzf on 2024/7/21.
 */
public class ApplyGccsTaskAdapter extends BaseQuickAdapter<ApplyGccsTask, BaseViewHolder> {

    public ApplyGccsTaskAdapter() {
        super(R.layout.item_apply_gccs_task_view);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, ApplyGccsTask bean) {

        holder.addOnClickListener(R.id.btn_task);

        holder.setText(R.id.tv_task_time, bean.getCreateTime());
        holder.setText(R.id.tv_task_name, bean.getXmmc());

        if (bean.getState() == "11") {
            // 采集中
            holder.setText(R.id.tv_task_state, "采集中");
            holder.setTextColor(R.id.tv_task_state, Color.parseColor("#009DFF"));
            holder.setText(R.id.btn_task, "继续采集");
        } else {
            holder.setText(R.id.tv_task_state, "未采集");
            holder.setTextColor(R.id.tv_task_state, Color.parseColor("#4BB9AC"));
            holder.setText(R.id.btn_task, "开始采集");
        }

    }
}
